package cn.edu.sjtu.flaw_detection.util;

import cn.edu.sjtu.flaw_detection.vo.ResultVO;
import cn.edu.sjtu.flaw_detection.enums.ResultEnum;

public class ResultUtil {

  public static <T> ResultVO success(T data) {
    ResultVO<T> resultVO = new ResultVO<>(ResultEnum.SUCCESS);
    resultVO.setData(data);
    return resultVO;
  }

  public static ResultVO success() {
    return new ResultVO<>(ResultEnum.SUCCESS);
  }

  public static ResultVO error(ResultEnum resultEnum) {
    return new ResultVO<>(resultEnum);
  }
}
